package com.wechat.back.mapper;

import com.wechat.back.pojo.comment.ArticleLike;
import com.wechat.back.pojo.comment.PoiLike;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface LikeMapper {
    //点赞表
    @Insert("insert into article_like(user_id, article_id, comment_id, create_time) " +
            "values (#{userId},#{articleId},#{commentId},#{createTime})")
    void addArticleLike(ArticleLike articleLike);

    @Insert("insert into poi_like(user_id, poi_id, comment_id, create_time) " +
            "values (#{userId},#{poiId},#{commentId},#{createTime})")
    void addPoiLike(PoiLike poiLike);

    @Select("select * from article_like where comment_id=#{commentId} and user_id=#{userId} and article_id=#{articleId}")
    List<ArticleLike> listArticleLike(ArticleLike articleLike);


    List<PoiLike> listPoiLike(Integer poiId, Integer userId);

    @Delete("delete from article_like where like_id=#{likeId}")
    void deleteArticleLike(Integer likeId);

    @Delete("delete from poi_like where like_id=#{likeId}")
    void deletePoiLike(Integer likeId);
}
